﻿using SuporeSliplampApp.Base;
using SuporeSliplampApp.Views;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;

namespace SuporeSliplampApp.ViewModels
{
    public class MainContentViewModel:NotifyBase
    {
        public MainContentViewModel()
        {
            //MainViewModel.GetInstance().NavPage("SuporeSliplampApp.Views.MainContent");
        }

        private CommandBase _menuItemCommand;
        public CommandBase MenuItemCommand
        {
            get
            {
                if (_menuItemCommand == null)
                {
                    _menuItemCommand = new CommandBase();
                    _menuItemCommand.DoExecute = new Action<object>(obj =>
                    {
                        //NavPage(obj.ToString());
                        MainViewModel.GetInstance().NavPage(obj.ToString());
                        MainViewModel.GetInstance().PatientVisibility = System.Windows.Visibility.Collapsed;
                        MainViewModel.GetInstance().ButtonVisibility = System.Windows.Visibility.Visible;
                    });
                }
                return _menuItemCommand;
            }

        }

        private CommandBase _addPatientCommand;
        public CommandBase AddPatientCommand
        {
            get
            {
                if (_addPatientCommand == null)
                {
                    _addPatientCommand = new CommandBase();
                    _addPatientCommand.DoExecute = new Action<object>(obj =>
                    {
                        addPatient();
                        //test();
                    });
                }
                return _addPatientCommand;
            }

        }

        private CommandBase _openPatientCommand;
        public CommandBase OpenPatientCommand
        {
            get
            {
                if (_openPatientCommand == null)
                {
                    _openPatientCommand = new CommandBase();
                    _openPatientCommand.DoExecute = new Action<object>(obj =>
                    {
                        OpenPatient();
                        //test();
                    });
                }
                return _openPatientCommand;
            }

        }

        private void addPatient()
        {
            NewPatientWindow newPatientWindow = new NewPatientWindow();
            newPatientWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            newPatientWindow.ShowDialog();
        }

        private void OpenPatient()
        {
            OpenPatients openPatient = new OpenPatients();
            openPatient.WindowStartupLocation = WindowStartupLocation.CenterScreen;
            openPatient.ShowDialog();
        }
    }
}
